package com.tutu.elementui.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Program: SpringBoot
 * @Description: 解决delete, put请求跨域问题
 * @Author: JK.TuTu
 * @Create: 2022-11-02 22:29
 **/
@Configuration(proxyBeanMethods = false)
public class RequestConfig {

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**").allowedMethods("*").allowedOrigins("*");
            }
        };
    }

}
